package com.csc531.adapters;

import java.util.ArrayList;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.csc531.DataTypes.Task;


/**
 * @author Javier Figueroa
 * Abstract class that extends BaseAdapter from Android API
 *
 */
public abstract class CustomListAdapter extends BaseAdapter 
{

	protected Context mContext;
	protected int _position = 0;
	protected ArrayList<Task> _tasks;

	protected ArrayList<Boolean> _mExpanded;

	/**
	 * @param context
	 */
	public CustomListAdapter(Context context)
	{
		mContext = context;
		_tasks = new ArrayList<Task>();
		_mExpanded = new ArrayList<Boolean>();
	}


	/**
	 * The number of items in the list is determined by the number of speeches
	 * in our ArrayList.
	 * 
	 * @see android.widget.ListAdapter#getCount()
	 */
	public int getCount()
	{
		return _tasks.size();
	}

	/**
	 * Return object in the ArrayList
	 * 
	 * @see android.widget.ListAdapter#getItem(int)
	 */
	public Object getItem(int position) 
	{
		return _tasks.get(position);
	}

	/**
	 * Use the ArrayList index as a unique id.
	 * @see android.widget.ListAdapter#getItemId(int)
	 */
	public long getItemId(int position) 
	{
		return position;
	}

	/**
	 * Make a ClassesView to hold each row.
	 * @see android.widget.ListAdapter#getView(int, android.view.View, android.view.ViewGroup)
	 */
	public abstract View getView(int position, View convertView, ViewGroup parent); 
}



